﻿package com.firewolf.observer.impl;

import com.firewolf.observer.itf.IDisplay;
import com.firewolf.observer.itf.IObservable;
import com.firewolf.observer.itf.IObserver;

/**
 * @author liuxing0
 * @function 显示当前的气象信息，观察者
 * @createtime 2014-8-19
 */
public class CurrentConditionDisplay implements IObserver,IDisplay{
	private float temperature;//温度
	private float humidity; //湿度
	private float pressure; //气压
	@SuppressWarnings("unused")
	private IObservable observable;//可观察者
	public CurrentConditionDisplay(IObservable observable) {
		this.observable = observable;
		observable.registerObserver(this);//注册
	}
	@Override
	public void update(float temperature,float humidity,float pressure) {
		this.temperature = temperature;
		this.humidity = humidity;
		this.pressure = humidity;
		display();
	}
	@Override
	public void display() {
		System.out.println("temperature:"+temperature+"   humidity:"+humidity+"   pressure:"+pressure);
	}
}
